﻿/************************************************************************
* Copyright (c) 2018 All Rights Reserved.
*命名空间：Wx.Standard
*文件名： WeChatServer
*创建人： kingling
*创建时间：2018/6/29 18:43:44
*描述
*=======================================================================
*修改标记
*修改时间：2018/6/29 18:43:44
*修改人：kingling
*描述：
************************************************************************/

using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Wx.Standard;
using Wx.Standard.Options;
using Wx.Standard.Service;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class WeChat
    {
        public static IServiceCollection UseWeChatApi(this IServiceCollection services, IConfiguration configuration)
        {
            services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
            services.AddScoped<WxApi>();
            services.Configure<ApiOption>(configuration);
            return services;
        }
        public static IServiceCollection UseWeChatPay(this IServiceCollection services, IConfiguration configuration)
        {
            services.AddScoped<WxPay>();
            services.Configure<PayOption>(configuration);
            return services;
        }
        public static IServiceCollection UseWeChatApp(this IServiceCollection services, IConfiguration configuration)
        {
            services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
            services.AddScoped<WxApp>();
            services.Configure<AppOption>(configuration);
            return services;
        }
    }
}
